package com.smit.livevideo.sample.util;

import com.smit.adapter.DVBAdapter;
import com.smit.adapter.DVBDevice;
import com.smit.dvb.ci.CIControl;
import com.smit.dvb.scan.ScanControl;
import com.smit.dvb.service.ServiceControl;
import com.smit.dvb.setup.SetupControl;
import com.smit.dvb.system.SystemControl;

/**
 * Created by smfang on 2015/12/31.
 * SDK 接口工具类的对象
 */
public final class SDKAPIUtil {
    /**所有使用的设备单例*/
    private static DVBDevice dvbDevice = DVBAdapter.getInstance().getDVBDeviceManager().getDVBDevice();
    /**dvb控制系统单例*/
    private static SystemControl systemControl = DVBAdapter.getInstance().getDVBManager().getSystemControl();
    /**搜台控制系统单例*/
    private static ScanControl scanControl = DVBAdapter.getInstance().getDVBManager().getScanControl();
    /**设置DVB播放单例*/
    private static SetupControl setupControl = DVBAdapter.getInstance().getDVBManager().getSetupControl();
    /**DVB播放控制单例*/
    private static ServiceControl serviceControl = DVBAdapter.getInstance().getDVBManager().getServiceControl();
    /**CI MMI控制单例*/
    private static CIControl ciControl = DVBAdapter.getInstance().getDVBManager().getCIControl();

    private SDKAPIUtil() {

    }

    /**
     * 获取DVBDevice对象
     * @return DVBDevice
     */
    public static DVBDevice getDVBDevice()
    {
        if (dvbDevice == null)
        {
            dvbDevice = DVBAdapter.getInstance().getDVBDeviceManager().getDVBDevice();
        }
        return dvbDevice;
    }

    /**
     * 获取SystemControl对象
     * @return SystemControl
     */
    public static SystemControl getSystemControl()
    {
        if (systemControl == null)
        {
            systemControl = DVBAdapter.getInstance().getDVBManager().getSystemControl();
        }
        return systemControl;
    }

    /**
     * 获取ScanControl对象
     * @return ScanControl
     */
    public static ScanControl getScanControl()
    {
        if (scanControl == null)
        {
            scanControl = DVBAdapter.getInstance().getDVBManager().getScanControl();
        }
        return scanControl;
    }

    /**
     * 获取SetupControl对象
     * @return SetupControl
     */
    public static SetupControl getSetupControl()
    {
        if (setupControl == null)
        {
            setupControl = DVBAdapter.getInstance().getDVBManager().getSetupControl();
        }
        return setupControl;
    }

    /**
     * 获取ServiceControl对象
     * @return ServiceControl
     */
    public static ServiceControl getServiceControl()
    {
        if (serviceControl == null)
        {
            serviceControl = DVBAdapter.getInstance().getDVBManager().getServiceControl();
        }
        return serviceControl;
    }

    /**
     * 获取CIControl对象
     * @return CIControl
     */
    public static CIControl getCIControl()
    {
        if (ciControl == null)
        {
            ciControl = DVBAdapter.getInstance().getDVBManager().getCIControl();
        }
        return ciControl;
    }
}
